/*
 *      stone.h
 *      
 *      Copyright 2008 Antti Leivo <skylark@skylark-desktop>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */


#ifndef GRAVSIMGUI_H
#define GRAVSIMGUI_H

#include <ClanLib/core.h>
#include <ClanLib/display.h>
#include <ClanLib/gl.h>
#include <ClanLib/mikmod.h>
#include <ClanLib/sound.h>

#include "world.h"

#define GRAVSIMGUI_DEFAULT_TIMESTEP 0.03
#define GRAVSIMGUI_DEFAULT_SPEED_SCALER 1.0
#define GRAVSIMGUI_DEFAULT_ZOOM_SPEED 2.0
#define GRAVSIMGUI_DEFAULT_SCROLL_SPEED 300.0
#define GRAVSIMGUI_DEFAULT_VIEW_DIST 50.0
class GUIControlVars {
  public:
   float focus_x, focus_y, focus_dist;

   float sim_speed_scaler, timestep;

   //bool up,down,left,right;
   //bool attack, mate, pull, quaff, cancel;
   //bool fast_move;

   bool zoom_in, zoom_out;
   bool scroll_up, scroll_down, scroll_left, scroll_right;

   //bool followObject;
   //bool creatureSelected;
   //union {
//	 Object *object; /* pointer to selected object */
//     Creature *creature; /*  pointer to selected creature (points to same as
//	                         "object". Only valid if "creatureSelected" is true */
//   } selection;

   GUIControlVars(void);
   //void setAction();
};

class GravsimGUI
{
	public:
		GravsimGUI(World *w);
        ~GravsimGUI();
        void run();
        ESysStatus getStatus();

        float world_x(int visual_x);
  	 	float world_y(int visual_y);
  	 	int visual_x(float world_x);
   		int visual_y(float world_y);
	
	private:
        /* world */
        World *w;
		GUIControlVars gcv;

		/* sim loop variables */
        ESysStatus status;
		bool overrun;
		
        /* functions for self use */
		void draw();
   		void drawStone(Stone *s);
		void processInputEvents();

		/* Clanlib basic objects */
		CL_ConsoleWindow console;
  	    CL_SetupCore setup_core;
        CL_SetupDisplay setup_display;
        CL_SetupGL setup_gl;
        CL_SetupSound setup_sound;
        CL_SetupMikMod setup_mikmod;

        CL_SoundOutput *sound_output;
        CL_DisplayWindow *window;
 		CL_GraphicContext *gc;

		CL_InputBuffer inputbuffer;

        CL_ResourceManager *resources;
        
 	    /* graphics and sprites */
		CL_Sprite *spr_ball;
		CL_Sprite *spr_box;
		
};

#endif /* GRAVSIMGUI_H */ 
